const {SyncLoopHook} = require("tapable");
//context react 上下文 JS
let hook = new SyncLoopHook(['name']);
let counter = 0;
hook.tap({context:true,name:'1'},(contxt,name)=>{
    console.log(1,contxt,name);
    let oldCount = isNaN(contxt.count)?0:contxt.count;
    contxt.count = oldCount+1;
    if(++counter == 2){
        return ;
    }
    return true;
});
hook.intercept({
    context:true,//当前正在使用上下文
    loop(context){//每次循环的时候执行
        context.loop = true;
        console.log('loop');
    }
});
hook.call('zhufeng');